package org.caijin.springrabbitMQ.mq;

import com.rabbitmq.client.Channel;
import com.rabbitmq.client.Delivery;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.io.IOException;

@Component
@RabbitListener(queues = "deadQueue")
public class DeadMessageConsumer {
    @RabbitHandler
    public void process(String msg ,Channel channel,Message message) throws IOException {
        System.out.println("[deadQueue] received message: " + msg);
        channel.basicAck(message.getMessageProperties().getDeliveryTag(),false);

    }
}
